using UnityEngine;

public class PanelInstance : MonoBehaviour
{
	public PanelInstance PanelBefore;

	public RuntimeAnimatorController runtimeAnim;

	public bool LockMouse;

	public bool isClosed;

	private bool hasAnimator;
    private MyAdManager adManager;

    public void OpenPanel(bool active)
	{
        isClosed = !active;
		base.gameObject.SetActive(active);
        Animator component = GetComponent<Animator>();
		if (component != null && component.isActiveAndEnabled)
		{
			component.SetBool("Open", active);
        }
	}

	private void OnDisable()
	{
		Animator component = GetComponent<Animator>();
		if ((bool)component)
		{
			UnityEngine.Object.Destroy(component);
		}
	}

	private void OnEnable()
	{
		if (hasAnimator)
		{
			Animator component = GetComponent<Animator>();
			if (component == null)
			{
				component = base.gameObject.AddComponent<Animator>();
				component.runtimeAnimatorController = runtimeAnim;
			}
		}
	}

	public void Closed()
	{
		isClosed = true;
	}

	private void Start()
	{
        adManager = new MyAdManager();
        Animator component = GetComponent<Animator>();
		if ((bool)component)
		{
			runtimeAnim = component.runtimeAnimatorController;
			hasAnimator = true;
		}
		else
		{
			hasAnimator = false;
		}
	}
}
